﻿using Dapper;
using Microsoft.AspNetCore.Mvc;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Web.WangLuo2.Connection.MySQL.Models;
using Web.WangLuo2.Connection.MySQL.Models.DB;
//using是要拿来使用的工具

namespace Web.WangLuo2.Connection.MySQL.DAL//DAL控制器的命名空间
{
    public class DAL_Student : Controller//子类继承父类，冒号前为子类，反之则为父类
    {
        public List<student> getStudent()//引用一个list名为student的列表，getstudent的方法
        {
            MySqlConnection mySqlConnection = new MySqlConnection(ConfigHelper.Configuration["MySQLConnectionString"]);//引用数据库
            var list = mySqlConnection.Query<student>("select  * from student ").ToList();//定义list，把数据库语句返还给list
            return list;//返回list
        }

    }
}
